#ifndef RBS_EXTENSION_AST_TRANSLATION_H
#define RBS_EXTENSION_AST_TRANSLATION_H

#include "compat.h"

SUPPRESS_RUBY_HEADER_DIAGNOSTICS_BEGIN
#include "ruby.h"
#include "ruby/encoding.h"
SUPPRESS_RUBY_HEADER_DIAGNOSTICS_END

#include "rbs/ast.h"
#include "rbs/location.h"

/// A bag of values needed when copying RBS C structs into Ruby objects.
typedef struct rbs_translation_context {
    rbs_constant_pool_t *constant_pool;
    VALUE buffer;
    rb_encoding *encoding;
} rbs_translation_context_t;

rbs_translation_context_t rbs_translation_context_create(rbs_constant_pool_t *, VALUE buffer_string, rb_encoding *ruby_encoding);

VALUE rbs_node_list_to_ruby_array(rbs_translation_context_t, rbs_node_list_t *list);
VALUE rbs_hash_to_ruby_hash(rbs_translation_context_t, rbs_hash_t *hash);
VALUE rbs_struct_to_ruby_value(rbs_translation_context_t, rbs_node_t *instance);

extern VALUE EMPTY_ARRAY;
extern VALUE EMPTY_HASH;

#endif
